from django.db import models

class ItemMaterialType(models.Model):
    name = models.TextField(unique=True)
    type = models.IntegerField(unique=True)

# http://howan.springnote.com/pages/3831419?read=1#toc_0
class Occupation(models.Model):
    name = models.TextField(unique=True)
    energy = models.IntegerField
    health = models.IntegerField
    attack = models.IntegerField
    defense = models.IntegerField
    
class OccupationAndItem(models.Model):
    occupation = models.ForeignKey(Occupation)
    item_type = models.ForeignKey(ItemMaterialType)
    
class Skill(models.Model):
    name = models.TextField(unique=True)
    attack = models.IntegerField
    energy = models.IntegerField
    type = models.IntegerField

class Tribe(models.Model):
    name = models.TextField(unique=True)
    
class Item(models.Model):
    name = models.TextField(unique=True)
    type = models.ForeignKey(ItemMaterialType)
    equip_slot = models.IntegerField
    attack = models.IntegerField
    defense = models.IntegerField
    slot_count = models.IntegerField
    slot1 = models.ForeignKey(Item)
    slot2 = models.ForeignKey(Item)
    
class Inventory(models.Model):
    item = models.ForeignKey(Item)
    item_count = models.IntegerField
    
class Character(models.Model):
    name = models.TextField(unique=True)
    level = models.IntegerField
    energy = models.IntegerField
    attack = models.IntegerField
    defense = models.IntegerField
    occupation = models.ForeignKey(Occupation)
    tribe = models.ForeignKey(Tribe)
    inventory = models.ForeignKey(Inventory)
    inventory_limit = models.IntegerField
    
